﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary.DataMining.ClusterAnalysis
{
    /// <summary>
    /// This class represents an item for cluster analysis.
    /// </summary>
    [Serializable]
    public class ClusterAnalysisItem : GeneralVector, IClusterAnalysisItem
    {
        /// <summary>
        /// The cluster index of the item.
        /// </summary>
        private double clusterIndex;

        /// <summary>
        /// The reference object of the item.
        /// </summary>
        private Object referenceObject;

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="vector">The vector to clone.</param>
        /// <param name="referenceObject">The reference object.</param>
        public ClusterAnalysisItem(GeneralVector vector, Object referenceObject)
            : base(vector)
        {
            this.clusterIndex = -1;
            this.referenceObject = referenceObject;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="dimension">The dimension of the vector.</param>
        /// <param name="referenceObject">The reference object.</param>
        public ClusterAnalysisItem(int dimension, Object referenceObject)
            : base(dimension)
        {
            this.clusterIndex = -1;
            this.referenceObject = referenceObject;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="data">The componentdatas of the vector in form of an array.</param>
        /// <param name="referenceObject">The reference object.</param>
        public ClusterAnalysisItem(double[] data, Object referenceObject)
            : base(data)
        {
            this.clusterIndex = -1;
            this.referenceObject = referenceObject;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="point">The point which should be included into the vector.</param>
        /// <param name="referenceObject">The reference object.</param>
        public ClusterAnalysisItem(Point2D point, Object referenceObject)
            : base(point)
        {
            this.clusterIndex = -1;
            this.referenceObject = referenceObject;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="point">The point which should be included into the vector.</param>
        /// <param name="referenceObject">The reference object.</param>
        public ClusterAnalysisItem(Point3D point, Object referenceObject)
            : base(point)
        {
            this.clusterIndex = -1;
            this.referenceObject = referenceObject;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="vector">The vector to clone.</param>
        public ClusterAnalysisItem(GeneralVector vector)
            : base(vector)
        {
            this.clusterIndex = -1;
            this.referenceObject = null;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="dimension">The dimension of the vector.</param>
        public ClusterAnalysisItem(int dimension)
            : base(dimension)
        {
            this.clusterIndex = -1;
            this.referenceObject = null;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="data">The componentdatas of the vector in form of an array.</param>
        public ClusterAnalysisItem(double[] data)
            : base(data)
        {
            this.clusterIndex = -1;
            this.referenceObject = null;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="point">The point which should be included into the vector.</param>
        public ClusterAnalysisItem(Point2D point)
            : base(point)
        {
            this.clusterIndex = -1;
            this.referenceObject = null;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterAnalysisItem"/> class.
        /// </summary>
        /// <param name="point">The point which should be included into the vector.</param>
        public ClusterAnalysisItem(Point3D point)
            : base(point)
        {
            this.clusterIndex = -1;
            this.referenceObject = null;
        }

        /// <summary>
        /// Gets or sets the reference object of the item.
        /// </summary>
        /// <value>The reference object of the item.</value>
        public object ReferenceObject
        {
            get { return referenceObject; }
            set { referenceObject = value; }
        }

        /// <summary>
        /// Gets or sets the cluster index of the item.
        /// </summary>
        /// <value>The cluster index of the item.</value>
        public double ClusterIndex
        {
            get { return clusterIndex; }
            set { clusterIndex = value; }
        }
    }
}